﻿using System.Runtime.CompilerServices;

namespace Net.FlowField
{
    // 网格单元结构体 (适合GPU)
    public struct GridCell
    {
        public Rect Rect;
        public int IsObstacle;
        public int IsOccupied;
        public int AgentId;

        public bool IsObstacleBool
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get => IsObstacle == 1;

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            set => IsObstacle = value ? 1 : 0;
        }

        public bool IsOccupiedBool
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get => IsOccupied == 1;

            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            set => IsOccupied = value ? 1 : 0;
        }
    }
}